package com.isman.placeslist;

import java.util.ArrayList;

import com.isman.placeslist.adapter.StatusAdapter;
import com.isman.placeslist.apiobject.Session;
import com.isman.placeslist.apiobject.Status;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.ProgressBar;

public class TabPlaceBoard extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tab_place_board);
		mLocationId = getIntent().getLongExtra(PagePlace.LOCATION_ID, 1);

		init();
		initData();

	}

	private void init() {
		vLvList = (ListView) findViewById(R.id.lvw_userBoard_list);
		vProgressBar = (ProgressBar) findViewById(R.id.pgb_head_load);
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//		super.onActivityResult(requestCode, resultCode, data);
//		switch (requestCode) {
//		case PageStatus.STATUS_DETAIL:
//			int index = data.getExtras().getInt(PageStatus.STATUS_INDEX, 0);
//			Status status = (Status) data.getExtras().getSerializable(
//					PageStatus.STATUS_INFO);
//			mStatusList.set(index, status);
//			mStatusAdapter.notifyDataSetChanged();
//			break;
//		}
	}

	protected void initData() {
		
//		StatusAdapterEvent event = new StatusAdapterEvent(this, mStatusList,
//				vProgressBar);
//		mStatusAdapter = new StatusAdapter(this, event, mStatusList);
//		event.setAdapter(mStatusAdapter);
//		vLvList.setAdapter(mStatusAdapter);
//
//		ServiceProvider provider = new ServiceProvider(this);
//		provider.LoadFeed(mSession.getId(), new AsyncRunnerHeadler() {
//			@Override
//			public void onComplete(String json) {
//				Type type = new TypeToken<ArrayList<Status>>() {
//				}.getType();
//
//				final ArrayList<Status> status = new Gson()
//						.fromJson(json, type);
//				runOnUiThread(new Runnable() {
//					@Override
//					public void run() {
//						mStatusList.clear();
//						mStatusList.addAll(status);
//						mStatusAdapter.notifyDataSetChanged();
//
//					}
//				});
//
//			}
//
//			@Override
//			public void onAuthenticate(String json) {
//				// TODO Auto-generated method stub
//
//			}
//
//			@Override
//			public void onError(int statusCode, String json) {
//				// TODO Auto-generated method stub
//
//			}
//
//			@Override
//			public void onConnectingError(String message) {
//				// TODO Auto-generated method stub
//
//			}
//		});
	}

	Session mSession = new Session();
	private long mLocationId;
	private StatusAdapter mStatusAdapter;
	private ArrayList<Status> mStatusList = new ArrayList<Status>();

	private ProgressBar vProgressBar;
	private ListView vLvList;
	
}
